package com.project.controller;

import com.github.pagehelper.PageInfo;
import com.project.bean.RoomBean;
import com.project.service.IRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("room")
public class RoomController {
    @Autowired
    private IRoomService service;
    @RequestMapping("findByItem")
    public PageInfo<RoomBean> findByItem(int pageNum,String address,Integer startPrice,Integer endPrice){
        return service.findByItem(pageNum,address,startPrice,endPrice);
    }

    @RequestMapping("add")
    public String add(RoomBean roomBean){
        service.add(roomBean);
        return "ok";
    }
    @RequestMapping("del")
    public String del(int id){
        service.del(id);
        return "ok";
    }
    @RequestMapping("findById")
    public RoomBean findById(int id){
      return   service.findById(id);
    }
    @RequestMapping("update")
    public String update(int id,int price){
        service.update(id,price);
        return "ok";
    }

}
